package com.lhb.mapper;

import com.lhb.pojo.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.swing.*;
import java.util.List;


@Mapper
public interface LoginMapper {

    /**
     * 登录检查
     * @param user
     * @return
     */
    @Select("select * from user where username=#{username} and password=#{password} ")
    User Login(User user);

    /**
     * 重置密码
     * @param usernameText
     * @return
     */
    @Update("update user set password='123456' where username=#{usernameText}")
    int resetPassword(String usernameText);

    /**
     * 根据username获得用户
     * @param username
     * @return
     */
    @Select("select * from user where username=#{username}")
    User getUserByUsername(String username);


}
